//demo 123
#include "valid.h"
#include <iostream>
using namespace std;
void inputInt(int &a,int min){
     char c;
     int k=0;
     while (k==0)
     {
         cin  >> a;
         if (cin.fail()) {
             cerr << "(!) Invalid character.  Try Again." << endl;
             cin.clear(); 
         } else if (a < min ) {
             cerr << "(!) Input must be greater than "<< min <<". Try Again." << endl;
             
         } else if (char(cin.get()) != '\n') {
             cerr << "Trailing characters.  Try Again." << endl; 
             
         } else
             k = 1;
         if (k!=1) { cout << "--Re-enter: "; cin.ignore(2000, '\n'); }

     }
}
void inputString(char *s,int max){
     int k=0;
     char a[11];
     while (k==0)
     {              
                    
           cin.getline(s,max+1);
           if (strlen(s)==0) {
                  cout << "(!)Empty string.\nTry again!\n";
                  cout << "--Re-enter: ";
           }
           else if (cin.good())  k=1;
           else {
                  cin.clear();
                  cin.ignore(INT_MAX, '\n');
                  cout << "(!)String must be no more than " << max << " characters\nTry again!\n";
                  cout << "--Re-enter: ";
                }
     }
}
